<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    535. Encode and Decode TinyURL
   </h1>
   <blockquote>
    Note: This is a companion problem to the
    <a href="https://leetcode.com/discuss/interview-question/system-design/" target="_blank">
     System Design
    </a>
    problem:
    <a href="https://leetcode.com/discuss/interview-question/124658/Design-a-URL-Shortener-(-TinyURL-)-System/" target="_blank">
     Design TinyURL
    </a>
    .
   </blockquote>
   <p>
    TinyURL is a URL shortening service where you enter a URL such as
    <code>
     https://leetcode.com/problems/design-tinyurl
    </code>
    and it returns a short URL such as
    <code>
     http://tinyurl.com/4e9iAk
    </code>
    .
   </p>
   <p>
    Design the
    <code>
     encode
    </code>
    and
    <code>
     decode
    </code>
    methods for the TinyURL service. There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be encoded to a tiny URL and the tiny URL can be decoded to the original URL.
   </p>
  </div>
  <div>
   <h1 class="question_title">
    535. TinyURL 的加密与解密
   </h1>
   <p>
    TinyURL是一种URL简化服务， 比如：当你输入一个URL&nbsp;
    <code>
     https://leetcode.com/problems/design-tinyurl
    </code>
    &nbsp;时，它将返回一个简化的URL&nbsp;
    <code>
     http://tinyurl.com/4e9iAk
    </code>
    .
   </p>
   <p>
    要求：设计一个 TinyURL 的加密&nbsp;
    <code>
     encode
    </code>
    &nbsp;和解密&nbsp;
    <code>
     decode
    </code>
    &nbsp;的方法。你的加密和解密算法如何设计和运作是没有限制的，你只需要保证一个URL可以被加密成一个TinyURL，并且这个TinyURL可以用解密方法恢复成原本的URL。
   </p>
  </div>
 </body>
</html>